<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增测试报告')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-componentinfo-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">接收日期：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input id="receivedDate" name="receivedDate" class="form-control" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试站名称：</label>
                <div class="col-sm-8">
                    <input id="registerNo" name="registerNo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">客户：</label>
                <div class="col-sm-8">
                    <input id="customer" name="customer" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">客户地址：</label>
                <div class="col-sm-8">
                    <input id="custormerAdd" name="custormerAdd" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试件名称：</label>
                <div class="col-sm-8">
                    <input id="deviceName" name="deviceName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">制造商：</label>
                <div class="col-sm-8">
                    <input id="manufacturer" name="manufacturer" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">规格型号：</label>
                <div class="col-sm-8">
                    <input id="model" name="model" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">序列号：</label>
                <div class="col-sm-8">
                    <input id="partserialNo" name="partserialNo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试地址：</label>
                <div class="col-sm-8">
                    <input id="testAdd" name="testAdd" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <input id="testDate" name="testDate" class="form-control" type="text">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">温度：</label>
                <div class="col-sm-8">
                    <input id="temp" name="temp" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">湿度：</label>
                <div class="col-sm-8">
                    <input id="humidity" name="humidity" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试依据：</label>
                <div class="col-sm-8">
                    <input id="testRef" name="testRef" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试仪器编号：</label>
                <div class="col-sm-8">
                    <input id="testInsNo" name="testInsNo" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试结论：</label>
                <div class="col-sm-8">
                    <input id="conclusion" name="conclusion" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试员：</label>
                <div class="col-sm-8">
                    <input id="testedBy" name="testedBy" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">检查员：</label>
                <div class="col-sm-8">
                    <input id="checkedBy" name="checkedBy" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">测试报告编号：</label>
                <div class="col-sm-8">
                    <input id="reportNo" name="reportNo" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script th:inline="javascript">
        var prefix = ctx + "system/componentinfo"

        $(function(){
            $("#receivedDate").datetimepicker();
            $("#testDate").datetimepicker();
        });

        $("#form-componentinfo-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            let receivedDate = $("#receivedDate").val();
            let registerNo = $("#registerNo").val();
            let customer = $("#customer").val();
            let custormerAdd = $("#custormerAdd").val();
            let deviceName = $("#deviceName").val();
            let manufacturer = $("#manufacturer").val();
            let model = $("#model").val();
            let partserialNo = $("#partserialNo").val();
            let testAdd = $("#testAdd").val();
            let testDate = $("#testDate").val();
            let temp = $("#temp").val();
            let humidity = $("#humidity").val();
            let testRef = $("#testRef").val();
            let testInsNo = $("#testInsNo").val();
            let conclusion = $("#conclusion").val();
            let testedBy = $("#testedBy").val();
            let checkedBy = $("#checkedBy").val();
            let reportNo = $("#reportNo").val();
            if ("" == receivedDate) {
                $.modal.alertWarning('请填写接收日期！');
                return;
            }
            if ("" == registerNo) {
                $.modal.alertWarning('请填写测试站名称！');
                return;
            }
            if ("" == customer) {
                $.modal.alertWarning('请填写客户！');
                return;
            }
            if ("" == custormerAdd) {
                $.modal.alertWarning('请填写客户地址！');
                return;
            }
            if ("" == deviceName) {
                $.modal.alertWarning('请填写测试件名称！');
                return;
            }
            if ("" == manufacturer) {
                $.modal.alertWarning('请填写制造商！');
                return;
            }
            if ("" == model) {
                $.modal.alertWarning('请填写规格型号！');
                return;
            }
            if ("" == partserialNo) {
                $.modal.alertWarning('请填写序列号！');
                return;
            }
            if ("" == testAdd) {
                $.modal.alertWarning('请填写测试地址！');
                return;
            }
            if ("" == testDate) {
                $.modal.alertWarning('请填写测试时间！');
                return;
            }
            if ("" == temp) {
                $.modal.alertWarning('请填写温度！');
                return;
            }
            if ("" == humidity) {
                $.modal.alertWarning('请填写湿度！');
                return;
            }
            if ("" == testRef) {
                $.modal.alertWarning('请填写测试依据！');
                return;
            }
            if ("" == testInsNo) {
                $.modal.alertWarning('请填写测试仪器编号！');
                return;
            }
            if ("" == conclusion) {
                $.modal.alertWarning('请填写测试结论！');
                return;
            }
            if ("" == testedBy) {
                checkResult = "0";
                $.modal.alertWarning('请填写测试员！');
                return;
            }
            if ("" == checkedBy) {
                $.modal.alertWarning('请填写检查员！');
                return;
            }
            if ("" == reportNo) {
                $.modal.alertWarning('请填写测试报告编号！');
                return;
            }

            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-componentinfo-add').serialize());
            }
        }
    </script>
</body>
</html>